<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
	<head>
		<title>添加客户订单</title>
		<script type="text/javascript" src="${pageContext.request.contextPath }/js/jquery.js"></script>
		<script type="text/javascript">
		function showTable(){
			var selobj=document.getElementById("oid");
			$.ajax( {
			type : "post",
			url : "customerOrder.action?method=QueryCustomer",
			success : function(page) {
				for(var p in page){
					var optObj=document.createElement("option");
					optObj.value=p;
					optObj.text=page[p];
					selobj.appendChild(optObj);
					//alert(page[p]);
				}
			}
		});
		}
		
    	function checkData(){
    		var oid=document.getElementById("oid").value;
    		if(oid=='-1'){
    			alert("未选择客户！");
    			return false;
    		}
    		var otxet=document.getElementById("otext").value;
    		if(otxet.length==0){
    			alert("未填写订单详情!");
    			return false;
    		}
    		var objname=document.getElementById("objname").value;
    		if(objname.length==0){
    			alert("未填写项目名称!");
    			return false;
    		}
    		var ocash=document.getElementById("ocash").value;
    		if(ocash.length==0||isNaN(ocash)){
    			alert("填写的不是数字！");
    			return false;
    		}
    		return true;
    	}
    	function back(){
    		var url='${pageContext.request.contextPath }/customer.action?method=queryCustomer';
    		window.location.href=url;
    	}
    </script>
    <style type="text/css">
    body {
				background-image:
				url(${pageContext.request.contextPath}/images/forum7.jpg);
			}
    </style>
	</head>

	<body onload="showTable();">
		<form onsubmit="return checkData();"
			action="${pageContext.request.contextPath}/customerOrder.action?method=saveCustomerOrder"
			method="post" enctype="multipart/form-data">
			<center>
				<h2>
					增加客户订单
				</h2>
			</center>
			<table border="0px" align="center">
				<tr>
					<td align="right">
						客户编号：
					</td>
					<td align="left">
						<select id="oid" name="oid">
							<option value="-1">
								--请选择--
							</option>
						</select>
					</td>
				</tr>
				<tr>
					<td align="right">
						订单详情：
					</td>
					<td align="left">
						<input type="file" name="otext" id="otext" accept=".doc,.docx,.zip"/>
					</td>
				</tr>
				<tr>
					<td align="right">
						项目名称：
					</td>
					<td align="left">
						<input type="text" name="objname" id="objname" />
					</td>
				</tr>
				<tr>
					<td align="right">
						订单报价：
					</td>
					<td align="left">
						<input type="text" name="ocash" id="ocash" />
					</td>
				</tr>
				<tr>
					<td align="center">
						<input type="submit" value="保存" />
					</td>
					<td align="center">
						<input type="reset" value="重置" />
					</td>
				</tr>
			</table>
			<center>
				<a href="#" onClick="back();">返回</a>
			</center>
		</form>
	</body>
</html>
